import http from '@/utils/http.js';
// 获取小文件上传链接数组
export function getShardingUrl(params) {
  return http({
    url: '/infra/file-small/multipart/initiate',
    method: 'get',
    params
  });
}
// 获取大文件上传链接数组
export function getMultipartUrl(params) {
  return http({
    url: '/infra/file/multipart/initiate',
    method: 'get',
    params
  });
}
// 合并小文件api
export function mergeFile(md5) {
  return http({
    url: '/infra/file-small/multipart/complete',
    params: { md5 }
  });
}
// 合并大文件api
export function mergeBigFile(md5) {
  return http({
    url: '/infra/file/multipart/complete',
    params: { md5 }
  });
}
// 获取小文件列表
export function getFileList(params) {
  return http({
    url: '/infra/file-small/list',
    method: 'get',
    params
  });
}

//重命名文件
export function renameFile(params) {
  return http({
    url: '/infra/file/rename',
    method: 'post',
    params
  });
}

// 获取大文件列表

export function getBigFileList(params) {
  return http({
    url: '/infra/file/list',
    method: 'get',
    params
  });
}

// 搜索文件
export function searchFile(params) {
  return http({
    url: '/infra/file/search',
    method: 'get',
    params
  });
}

// 删除文件 （移入回收站）
export function deleteFile(params) {
  return http({
    url: '/infra/file/moveto-dump',
    method: 'post',
    params
  });
}

// 彻底删除文件
export function deleteFileLog(params) {
  return http({
    url: '/infra/file/delete',
    method: 'delete',
    params
  });
}

export function recoverFile(params) {
  return http({
    url: '/infra/file/restore-from-dump',
    method: 'post',
    params
  });
}

// 添加目录
export function addFolder(params) {
  return http({
    url: '/infra/file/create-folder',
    method: 'get',
    params
  });
}

// 删除目录
export function deleteFolder(data) {
  return http({
    url: '/file/folder_del',
    method: 'post',
    data
  });
}

// 彻底删除目录
export function deleteFolderLog(data) {
  return http({
    url: '/file/folder_log_del',
    method: 'post',
    data
  });
}

// 获取分享列表
export function getShareList(params) {
  return http({
    url: '/share/share_list',
    method: 'get',
    params
  });
}

// 添加分享
export function addShare(data) {
  return http({
    url: '/infra/file-share/create',
    method: 'post',
    data
  });
}

export function updateShare(data) {
  return http({
    url: '/infra/file-share/update',
    method: 'put',
    data
  });
}

// 删除分享
export function deleteShare(params) {
  return http({
    url: '/infra/file-share/delete',
    method: 'delete',
    params
  });
}

// 获取下载链接
export function getDownloadUrl(data) {
  return http({
    url: '/infra/file-share/get-public/download-url',
    method: 'post',
    data
  });
}

// 转存到个人云盘
export function transferToPersonal(data) {
  return http({
    url: '/infra/file/transfer-to',
    method: 'post',
    data
  });
}

// 回收站列表
export function delFileList(params) {
  return http({
    url: '/file/file_del_list',
    method: 'get',
    params
  });
}
// 分享详情
export function shareFile(params) {
  return http({
    url: '/infra/file-share/get',
    method: 'get',
    params
  });
}

// 邮箱分享详情
export function emailShareFile(data) {
  return http({
    url: '/infra/file-share/sendEmail',
    method: 'post',
    data
  });
}
// 分享文件详情
export function shareFileDetail(data) {
  return http({
    url: '/infra/file-share/get-public/check',
    method: 'post',
    data
  });
}

export function getShareLink(params) {
  return http({
    url: '/infra/file-share/get-public',
    params
  });
}

// 下载小文件
export function downloadPoints(params) {
  return http({
    url: '/infra/file-small/presigned-download-url',
    method: 'get',
    params
  });
}

// 下载大文件

export function downloadBigPoints(params) {
  return http({
    url: '/infra/file/presigned-download-url-and-pay',
    method: 'get',
    params
  });
}

export function getPreview(params) {
  return http({
    url: '/infra/file-small/preview',
    method: 'get',
    params
  });
}

export function getBigPreview(params) {
  return http({
    url: '/infra/file/preview',
    method: 'get',
    params
  });
}

export function getDownTentacleUrl(params) {
  return http({
    url: '/infra/file/get-compressed-pkg-download-url',
    params
  });
}

export function movetoFolder(params) {
  return http({
    url: '/infra/file/move-to-folder',
    method: 'post',
    params
  });
}

export function reportAbuse(data) {
  return http({
    url: '/infra/file-report/create',
    method: 'post',
    data
  });
}

export function getMyOrders() {
  return http({
    url: '/pay/filePurchase/myOrders',
    method: 'get',
    params: {
      pageNo: 1,
      pageSize: 99,
      status: 10
    }
  });
}

export function getFolderSize(params) {
  return http({
    url: '/infra/file/sum-folder-size',
    method: 'get',
    params
  });
}
